//
//  ljjiftViewCoordinate.ljjift
//  AiTouYun
//
//  Created by liujunjie on 2018/9/19.
//  Copyright © 2018年 junjie.liu. All rights reserved.
//

import UIKit


public extension UIView {
    
    // MARK: - 常用位置属性
    public var ljj_left: CGFloat {
        get {
            return self.frame.origin.x
        }
        set(newLeft) {
            var frame = self.frame
            frame.origin.x = newLeft
            self.frame = frame
        }
    }
    
    public var ljj_top: CGFloat {
        get {
            return self.frame.origin.y
        }
        
        set(newTop) {
            var frame = self.frame
            frame.origin.y = newTop
            self.frame = frame
        }
    }
    
    public var ljj_width: CGFloat {
        get {
            return self.frame.size.width
        }
        
        set(newWidth) {
            var frame = self.frame
            frame.size.width = newWidth
            self.frame = frame
        }
    }
    
    public var ljj_height: CGFloat {
        get {
            return self.frame.size.height
        }
        
        set(newHeight) {
            var frame = self.frame
            frame.size.height = newHeight
            self.frame = frame
        }
    }
    
    public var ljj_right: CGFloat {
        get {
            return self.ljj_left + self.ljj_width
        }
    }
    
    public var ljj_bottom: CGFloat {
        get {
            return self.ljj_top + self.ljj_height
        }
    }
    
    public var ljj_centerX: CGFloat {
        
        get {
            return self.center.x
        }
        
        set(newCenterX) {
            var center = self.center
            center.x = newCenterX
            self.center = center
        }
    }
    
    public var ljj_centerY: CGFloat {
        
        get {
            return self.center.y
        }
        
        set(newCenterY) {
            var center = self.center
            center.y = newCenterY
            self.center = center
        }
    }
    
}
